import Axios from 'axios'
import request from '@/utils/request'
const cfgBaseUrl = 'https://cfg-xzapi.cqttech.com'
/**
 * 获取图形验证码
 * http://192.168.88.247:4999/web/#/14/48
 * @returns
 */
const VUE_APP_USER_URL = process.env.VUE_APP_USER_URL
/**
 * 上传用户图像
 * http://showdoc.wisetimes.cn:4999/web/#/92/596
 * @returns
 */
export function uploadImage (data) {
  return request({
    url: VUE_APP_USER_URL + '/api/v1/uploadImg',
    method: 'post',
    data
  })
}

/**
 * 获取活动列表
 * http://192.168.88.247:4999/web/#/105/1982
 * @returns
 */
export function activityList () {
  return request({
    noMsg: true,
    url: '/api/v1/activity/list',
    method: 'get'
  })
}

/**
 * 获取活动列表权益包
 */
export function getPrdoductDetail (params) {
  return request({
    url: '/api/v1/product/detail',
    method: 'get',
    noMsg: true,
    params
  })
}

/**
 * 查看用户活动领取情况
 * http://192.168.88.247:4999/web/#/105/3040
 * @returns
 */
export function getUserActivity (params) {
  return request({
    noMsg: true,
    url: '/api/v1/activity/user_activity_info',
    method: 'get',
    params
  })
}
// 获取配置后台的配置
export function getBackEndConfig (params) {
  return Axios({
    baseURL: cfgBaseUrl,
    url: `/api/v1/cs/configdata`,
    method: 'get',
    params
  })
}

// 通过短id上报
export function reportWithShorid (data) {
  return request({
    url: 'https://ocpc-xztodo.cqttech.com/ocpc/sendWithShorid',
    method: 'post',
    data
  })
}

/**
 * 领取活动奖励
 * http://192.168.88.247:4999/web/#/105?page_id=2961
 * @returns
 */
export function drawUserActivity (data) {
  return request({
    noMsg: true,
    url: '/api/v1/activity/draw_reward',
    method: 'post',
    data
  })
}
